source ~/ENV/PYTHON/spider/bin/activate

cd ./testPro
currTime=$(date +"%Y-%m-%d")
path=output-$currTime
mkdir ../outputs/$path

# 配置表获取
echo 阿里云基础配置表获取中...
scrapy crawl ali-family
echo 阿里云详细配置表获取中...
scrapy crawl ali-family-details

echo 百度云基础配置表获取中...
scrapy crawl bai-family
echo 百度云详细配置表获取中...
scrapy crawl bai-family-details

echo 腾讯云基础配置表获取中...
scrapy crawl tcnt-family
echo 腾讯云详细配置表获取中...
scrapy crawl tcnt-family-details

echo 华为云基础配置表获取中...
scrapy crawl hua-family
echo 华为云详细配置表获取中...
scrapy crawl hua-family-details

# 价格表获取
scrapy crawl bai-price
scrapy crawl hua-price
# 实例规格族 vCpu:内存 配比计算
echo "配比计算中..."
python ./testPro/TableUnion.py

echo "年费价格计算中..."
python ./testPro/CalculatePrice.py bai-price
python ./testPro/CalculatePrice.py ali-price
python ./testPro/CalculatePrice.py tcnt-price

# while true
# do
#     read -r -p "是否翻译 实例规格族应用场景（这需要五分钟） Y/N: " input

#     case $input in
#         [yY][eE][sS]|[yY])
python ./testPro/Translator.py ali-family
python ./testPro/Translator.py bai-family
python ./testPro/Translator.py tcnt-family
python ./testPro/Translator.py hua-family
#             break 1
#             ;;

#         [nN][oO]|[nN])
#             echo "跳过翻译" 
#             break 1         
#             ;;

#         *)
#             echo "无效输入 ......"
#             ;;
#     esac
# done

# 从testPro中Copy来output
cp -r ./testPro/output/* ../outputs/$path

cd ..

ls ./outputs|grep output > ./history.txt

sort ./history.txt -o ./history.txt

python ./utils/cache.py

rm -rf ./result.zip

zip -r result.zip difference ./outputs/$path

python ./utils/AutoMail.py